import { IPSAppDEReport } from '../../app/dataentity/ipsapp-dereport';
import { PSControlImpl } from '../pscontrol-impl';
import { IPSDEReportPanel } from './ipsdereport-panel';

export class PSDEReportPanelImpl extends PSControlImpl implements IPSDEReportPanel {
  get codeName(): string {
    return this.M.codeName;
  }

  protected psappdereport: IPSAppDEReport | null = null;

  getPSAppDEReport(): IPSAppDEReport | null {
    if (this.psappdereport != null) return this.psappdereport;
    const value = this.M.getPSAppDEReport;
    if (value == null) {
      return null;
    }
    this.psappdereport = this.getPSModel4('app.dataentity.IPSAppDEReport', value, 'getPSAppDEReport') as IPSAppDEReport;
    return this.psappdereport;
  }

  get psAppDEReport(): IPSAppDEReport | null {
    return this.getPSAppDEReport();
  }

  getPSAppDEReportMust(): IPSAppDEReport {
    const value = this.getPSAppDEReport();
    if (value == null) {
      throw new Error('未指定应用实体报表对象');
    }
    return value;
  }

  get cls(): string {
    return 'PSDEReportPanelImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.reportpanel.IPSDEReportPanel') return true;
    return super.instanceof(cls);
  }
}
